package controllers

import (
	"github.com/kataras/iris/v12/mvc"
	"punch-in/services"
)

type IndexController struct {
	Service services.PunchService
}

/**
 * 获取打卡记录
 */
func (c *IndexController) Get() mvc.Result {
	data := c.Service.GetByDate()
	data["curTime"] = c.Service.GetCurTime()
	data["curWeek"] = c.Service.GetCurWeek()
	data["times"] = c.Service.GetTimes()
	data["weeks"] = c.Service.GetWeeks()
	return mvc.View{
		Name: "index.html",
		Data: data,
	}
}
